<script setup>
	
	import { onMounted, ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import { http } from '@/utils/http.js'
	import { parseTime } from '@/utils/index.js'

	
		
		const rulepopup = ref()
		function  openRulePop(){
			rulepopup.value.open('center')
		}
		
		
		
		
</script>

<template>
	<view  class="coupon-contant">
		
			<!-- //状态切换 -->
			<view class="status">
				<view class="available"  style="background-color: #E5D9FF; color: #7948EA;">可使用</view>
				<view class="available" >已使用</view>
				<view class="available" >已过期</view>
			</view>
			<!-- //优惠券列表 -->
			<view class="status-list">
				
				<view class="coupon-money">
					<view class="amount" >
						<text style="font-size: 32rpx">￥</text>
						<view class="amount" >5</view>
					</view>
					<view class="way" >满100元可用</view>
				</view>
				<view class="coupon-content">
					<view class="title">满减优惠券</view>
					<view class="time">有效期至2024.05.12</view>
					<view class="rule" @click="openRulePop">规则></view>
				</view>
				<view class="coupon-name" >
					<view class="goto-use">立即使用</view>
					<view class="star">
						<image  src="https://ojqn.wm2177.com/wechat_imgs/kapai-test/star.png"></image>
					</view>
				</view>
			</view>
			<!-- 规则弹出层 -->
			<uni-popup ref="rulepopup" type="center">
				<view class="rulepopup-content">
					<view class="rule-content-title"> 使用规则 </view>
					<view class="rule-content-content">这是规则内容</view>
					<view class="rule-content-button">
						<image src="https://ojqn.wm2177.com/wechat_imgs/kapai-test/mine/ok-btn.png"></image>
					</view>
				</view>
			</uni-popup>
	</view>
	
</template>

<style lang="scss" scoped>
	
	.coupon-contant {
		background-color: #E9EAF2;
		min-height: 100vh;
		// font-family: OPPOSans;
	}
	.status {
		justify-content: space-evenly;
		align-items: center;
		display: flex;
		height: 100rpx;
		text-align: center;
		font-weight: 600;
		background-color: #fff;
		padding: 20rpx;
	}
	.available {
		width: 126rpx;
		height: 54rpx;
		font-weight: 600;
		background-color: #F5F5F5;
		color: #808080;
		border-radius: 14rpx;
		text-align: center;
		margin-left: 30rpx;
		line-height: 54rpx;
		font-size: 24rpx;
	}
	.notuse {
		background-color: $all-color;
		color: #3d3d3d;
	}
	.status-list {
		display: flex;
		align-items: center;
		width: 90vw;
		margin: 30rpx auto;
		background-color: #fff;
		height:180rpx;
		border-radius: 26rpx;
		border: 4rpx solid #740B00;
		.coupon-money {
			height: 140rpx;
			width: 140rpx;
			background: linear-gradient(90deg, #B6A1E3 0%, #9196EB 100%);
			margin-left: 30rpx;
			border-radius: 14rpx;
			color: #fff;
			font-weight: 600;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			margin-right: 20rpx;
			flex-shrink: 0;
			.amount {
				font-size: 40rpx;
				display: flex;
			}
			.way {
				line-height: 30rpx;
				font-size: 20rpx;
				font-weight: 400;
				text-align: center;
			}
		}
		.coupon-content {
			flex-shrink: 0;
			width: 327rpx;
			.title {
				font-size: 32rpx;
				color: #3d3d3d;
				font-weight: 500;
			}
			.time {
				font-size: 22rpx;
				color: #9b9b9d;
			}
			.rule {
				font-size: 22rpx;
				color: #9b9b9d;
				margin-top: 30rpx;
			}
		}
		.coupon-name {
			position: relative;
			margin-top: 85rpx;
			.goto-use {
				border-radius:14rpx;
				width: 116rpx;
				height: 46rpx;
				color: #7948EA;
				background-color: #fff;
				font-size: 26rpx;
				line-height: 46rpx;
				text-align: center;
				border: 2rpx solid #7948EA;
			}
			.star{
				position: absolute;
				top: -13rpx;
				left: -14rpx;
				image{
					width: 34rpx;
					height: 34rpx;
				}
			}
		}	
	}
	
	.rulepopup-content {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 648rpx;
		height: 494rpx;
		padding: 50rpx 46rpx;
		box-sizing: border-box;
		border: 3rpx solid #740B00;
		background-color: #fff;
		border-radius:26rpx;
		.rule-content-title {
			margin-bottom: 54rpx;
			font-size: 40rpx;
			text-align: center;
		}
		.rule-content-content {
			height: 202rpx;
			box-sizing: border-box;
			font-size: 24rpx;
			color: #9b9b9d;
		}
		.rule-content-button {
			margin: auto;
			image{
				width: 238rpx;
				height: 84rpx;
			}
		}
	}
</style>
